package com.tom.architect02.p4.day37.simple3;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import com.tom.architect02.R;

public class MainActivity3703 extends AppCompatActivity implements UserInfoContact.UserInfoView {
    private TextView mTextView;
    private UserInfoPresenter mPresenter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main37);
        mTextView = findViewById(R.id.textView37);

        // 调用presenter的方法，获取user信息。
        mPresenter = new UserInfoPresenter();
        mPresenter.attach(this);
        mPresenter.getUser("token");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.detach();
    }

    @Override
    public void onLoading() {
        // 加载进度条
    }

    @Override
    public void onError() { // 显示错误

    }

    @Override
    public void onSucceed(UserInfo userInfo) { // 成功了。
        mTextView.setText(userInfo.toString());

    }

}
